<template>
	<view class="container ql-container">
		<rich-text class="ql-editor" :nodes="nodesHtml"></rich-text>
	</view>
</template>

<script>
	import parseHtml from '@/utils/html-parse.js'
	export default {
		data() {
			return {
				nodesHtml: ''
			}
		},
		onLoad() {
			this.getDataList()
		},
		methods: {
			getDataList() {
				this.$http.ajax({
					url: '/SystemSetUp/list',
					params: {}
				}).then((res) => {
					if (res.code == 200 && res.data.length > 0) {
						var text = res.data[0].useAgreement
						var arr = parseHtml(text)
						arr.forEach(item => {
							if (item.children && item.children.length > 0) {
								item.children.forEach(i => {
									if (i.name == 'img') {
										i.attrs.style += 'display: block;'
									}
								})
							}
						})
						this.nodesHtml = arr
					} else {
						this.$api.msg('暂未设置服务协议')
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.container {
		padding: 20rpx;
		
	}
	
	.ql-container {
		min-height: 100% !important;
		height: auto;
	}
	
	.ql-container img {
		display: block;
	}
</style>
